﻿using System;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Validation;
using System.Linq;
using System.Text;
using System.Configuration;

using Comswing.Business.Entities;
using Comswing.Data.Configuration;

namespace Comswing.Data.Core
{
    public class DataContext : DbContext
    {
        public DataContext()
        {
            Configuration.ProxyCreationEnabled = false;
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations
                .Add(new UserConfiguration())
                .Add(new UserLogConfiguration())
                .Add(new ProfileConfiguration())
                .Add(new SwingConfiguration())
                .Add(new UserSwingConfiguration())
                .Add(new OrganizationConfiguration())
                .Add(new OrganizationSwingConfiguration());
        }

        //Los DbSet deben tener el mismo nombre que la entity correspondiente

        public DbSet<User> User { get; set; }
        public DbSet<UserLog> UserLog { get; set; }
        public DbSet<Profile> Profile { get; set; }
        public DbSet<Swing> Swing { get; set; }
        public DbSet<UserSwing> UserSwing { get; set; }
        public DbSet<Organization> Organization { get; set; }
        public DbSet<OrganizationSwing> OrganizationSwing { get; set; }
    }
}
